package chunmap.example.googlemap;

import java.awt.BasicStroke;

import chunmap.app.MapCtrl;
import chunmap.data.provider.LayerFactory;
import chunmap.example.BaseMap;
import chunmap.model.crs.CoordinateRSystem;
import chunmap.model.crs.proj.Mercator;
import chunmap.model.crs.proj.ReProjOp;
import chunmap.raster.gmap.*;
import chunmap.view.layer.Layer;
import chunmap.view.layer.VectorLayer;
import chunmap.view.render.GeneralSymbol;
import chunmap.view.render.Style2D;
import chunmap.view.render.Symbol;

public class GMClient  extends BaseMap {
	public static void main(String[] args) {

		GMClient me = new GMClient();
		me.init();
	}

	@Override
	protected void addLayer(MapCtrl map) {
		Layer layer = new GMLayer();
		map.getLayerCollection().add(layer);
		
		String path1="D:\\Temp\\mapdata\\cntry02\\cntry02.shp";
		VectorLayer layer1 = (VectorLayer) LayerFactory.openShapeFile(path1);
		
		//style
		Style2D style = new Style2D();
		style.setNeedArea(false);
		style.setStroke(new BasicStroke(3));
		layer1.setDefaultStyle(new Symbol[]{new GeneralSymbol(style)});
		
		//reproj
		CoordinateRSystem target = new CoordinateRSystem();
        target.setProjection(new Mercator());
		ReProjOp.changeCRS(layer1.getFeatures(), target);
		
        map.getLayerCollection().add(layer1);
	}
}
